<template>
  <div class="inputbox">
    <input type="text" placeholder="输入任务名称" v-model="taskName">
    <div @click="clickadd">新增</div>
  </div>
</template>

<script>
export default {
    data(){
        return{
            taskName:''
        }
    },
    methods:{
        clickadd(){
            this.$store.commit('addName',this.taskName);
            this.taskName='';
        }
    }
}
</script>

<style lang="scss" scoped>
.inputbox{
    display: flex;
    margin-bottom: 10px;
    input{
        border: 0;
        outline: none;
        background-color: #ccc;
        box-sizing: border-box;
        padding: 10px 10px;
        border-radius: 5px;
        margin-right: 10px;
        flex: 1;
    }
    div{

        width: 60px;
        text-align: center;
        line-height: 36px;
        color: lightseagreen;
    }
}

</style>